package com.fuxue.controller.server;

import com.fuxue.result.Result;
import com.fuxue.service.RanklistService;
import com.fuxue.vo.RankListVO;
import com.fuxue.vo.RankVO;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

import static com.alibaba.druid.util.MySqlUtils.getId;

@RestController
    @RequestMapping("/users/server/Rank")
@Slf4j
@Api(tags = "服务者排行榜相关接口")
public class RanklistController {
        @Autowired
        private RanklistService ranklistService;

       @GetMapping("/Onerank")
       private Result<RankVO>SelectOne(Integer id)
       {
           log.info("查找个人排名,参数为，{}",id);
           RankVO rankVO = ranklistService.getRand(id);

           return Result.success(rankVO);
       }
       @GetMapping("/allrank")
       private Result<List<RankListVO>> getAllRank()
       {
           log.info("全体排名");
           List<RankListVO>list  = new ArrayList<RankListVO>();
           list = ranklistService.getRank();
           return Result.success(list);
       }
}
